package com.ryan.framework.dto;

import java.io.Serializable;

public class PageView implements Serializable {

	private static final long serialVersionUID = 8007944048337473098L;
	// 记录总数
	private Integer totalRecordCount = new Integer(0);
	// 页码
	private Integer targetPage = new Integer(1);
	// 默认每页显示记录数
	private Integer pageRecordCount = new Integer(10);
	// 总页数
	private Integer totalPage=new Integer(10);

	public Integer getTotalRecordCount() {
		return totalRecordCount;
	}

	public void setTotalRecordCount(Integer totalRecordCount) {
		this.totalRecordCount = totalRecordCount;
	}

	public Integer getTargetPage() {
		return targetPage;
	}

	public void setTargetPage(Integer targetPage) {
		if(targetPage>totalPage){
			targetPage = totalPage;
			pageRecordCount = new Integer(10);
		}
		if(pageRecordCount>totalRecordCount){
			pageRecordCount=totalRecordCount;
			targetPage = new Integer(1);
		}
		this.targetPage = targetPage;
	}

	public Integer getPageRecordCount() {
		return pageRecordCount;
	}

	public void setPageRecordCount(Integer pageRecordCount) {
		if(targetPage>totalPage){
			targetPage = totalPage;
			pageRecordCount = new Integer(10);
		}
		if(pageRecordCount>totalRecordCount){
			pageRecordCount=totalRecordCount;
			targetPage = new Integer(1);
		}
		this.pageRecordCount = pageRecordCount;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	
	
	
	/*

	public Integer getTargetPage() {
		return targetPage;
	}

	public void setTargetPage(Integer targetPage) {
		if(pageRecordCount>totalRecordCount){
			pageRecordCount=totalRecordCount;
			targetPage=1;
		}
		if(targetPage>getTotalPage()){
			targetPage=getTotalPage();
		}
		this.targetPage = targetPage;
	}


	*//**
	 * @return Returns the totalPage.
	 *//*
	public Integer getTotalPage() {
		if (totalRecordCount.intValue() <= 0) {
			return 0;
		} else {
			return ((totalRecordCount.intValue() - 1) / pageRecordCount.intValue()) + 1;
		}
	}

	public Integer getTotalRecordCount() {
		return totalRecordCount;
	}

	public void setTotalRecordCount(Integer totalRecordCount) {
		if(pageRecordCount>totalRecordCount){
			pageRecordCount=totalRecordCount;
			targetPage=1;
		}
		if(targetPage>getTotalPage()){
			targetPage=getTotalPage();
		}
		this.totalRecordCount = totalRecordCount;
	}

	public Integer getPageRecordCount() {
		return pageRecordCount;
	}

	public void setPageRecordCount(Integer pageRecordCount) {
		if(pageRecordCount>totalRecordCount){
			pageRecordCount=totalRecordCount;
			targetPage=1;
		}
		if(targetPage>getTotalPage()){
			targetPage=getTotalPage();
		}
		this.pageRecordCount = pageRecordCount;
	}

*/
}
